package ms.actuator.job.service;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

/**
 * @Author ybc
 * @Date 2021/6/23 17:27
 */
@Slf4j
@Component
public class FeignFallBack implements FallbackFactory {

    @Override
    public Object create(Throwable cause) {
        log.error(">>>>>>>>>>> FeignFallBack Exception : {}",cause.toString());
        String msg = cause == null ? "" : cause.getMessage();
        if (!StringUtils.isEmpty(msg)) {
            log.error(">>>>>>>>>>> FeignFallBack Exception Msg : {}",msg);
        }
        return null;
    }

}
